//package com.yunhe.device.repository.base;
//
//import com.yunhe.device.domain.base.AnalogStatus;
//import org.springframework.data.neo4j.annotation.Query;
//import org.springframework.data.neo4j.repository.Neo4jRepository;
//import org.springframework.data.repository.query.Param;
//import org.springframework.stereotype.Repository;
//
//import java.util.List;
//
///**
// * 点表状态repository
// * @author liuronglei
// */
//@Repository
//public interface AnalogStatusRepository extends Neo4jRepository<AnalogStatus, Long> {
//
//    /**
//     * 根据代码获得点表状态对象
//     * @param code 代码
//     */
//    AnalogStatus findByCode(Long code);
//
//    /**
//     * 根据编号获得点表状态对象
//     * @param name 编号
//     */
//    AnalogStatus findByName(String name);
//
//    /**
//     * 查找告警状态对应的点号
//     */
//    @Query("match(a:AnalogStatus)<-[:ANALOGSTATUS_OF]-(p:PointDataType)<-[:POINTDATATYPE_OF]-(r:Analog) return r.pointNumber")
//    Iterable<Long> findPointNumbers();
//
//    /**
//     * 根据点号查找告警状态
//     * @param pnList 点号列表
//     */
//    @Query("match (a:Analog)-[:POINTDATATYPE_OF]->(p:PointDataType)-[:ANALOGSTATUS_OF]->(r:AnalogStatus) where a.pointNumber in {pnList} " +
//            "return a.pointNumber as code,r.title as title,r.val as val")
//    Iterable<AnalogStatus> findByPointNumber(@Param("pnList") List<Long> pnList);
//
//    /**
//     * 根据代码绑定点号数据类型
//     * @param code 代码
//     * @param pointTypeCode 点号数据类型代码
//     */
//    @Query("match(a:AnalogStatus{code:{code}}) match(p:PointDataType{code:{pointDataTypeCode}}) create(p)-[:ANALOGSTATUS_OF]->(a)")
//    void bindPointDataTypeByCode(@Param("code") Long code, @Param("pointTypeCode") Long pointTypeCode);
//
//    @Query("match(a:Analog{pointNumber:{pointNumber}})-[:POINTDATATYPE_OF]->(p:PointDataType)-[:ANALOGSTATUS_OF]->(s:AnalogStatus) where s.val={value} return s")
//    AnalogStatus findByPointNumberAndValue(@Param("pointNumber") Long pointNumber,
//                                           @Param("value") Double value);
//
////    @Query("match(a:Analog{pointNumber:{pointNumber}})-[]->(p:PointDataType) with p match(s2:AnalogStatus)<-[]-(p)-[]->(s1:AnalogStatus) " +
////            "where s1.val={value1} and s2.val={value2} return s1.title+':'+s2.title")
////    String getAnalogStatus(@Param("pointNumber") Long pointNumber,
////                           @Param("value1") Double value1,
////                           @Param("value2") Double value2);
//}
